# 导包

import requests, app


# 建立部门组织架构类
class Department(object):
    def __init__(self):
        self.url_depart=app.BASE_URL + "/api/company/department"

    def depart_list(self, headers):
        url_list = self.url_depart
        return requests.get(url=url_list,
                            headers=headers)

    def depart_info(self,headers):
        url_info=self.url_depart
        return requests.get(url=url_info,
                            headers=headers)

    def add_depart(self,headers,jsonData):
        url_add=self.url_depart
        return requests.post(url=url_add,
                             headers=headers,
                             json=jsonData)

    def update_depart(self,headers,jsonData,id):
        url_update=self.url_depart+"/"+id
        return requests.put(url=url_update,
                            headers=headers,
                            json=jsonData)

    def delete_depart(self,headers,id):
        url_delete=self.url_depart+"/"+id
        return requests.delete(url=url_delete,
                               headers=headers)
